import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 文章
 */
@Entity('article_article')
export class ArticleArticleEntity extends BaseEntity {
  @Index()
  @Column({ comment: '标题', length: 255 })
  title: string;

  @Column({ comment: '封面图', nullable: true })
  coverImage: string;

  @Column({ comment: '内容', type: 'text' })
  content: string;

  @Column({ comment: '排序', default: 0 })
  order: number;

  @Column({ comment: '状态', dict: ['待发布', '已发布'], default: 0 })
  status: number;

  @Column({ comment: '点赞数', default: 0 })
  likeCount: number;

  @Column({ comment: '浏览量', default: 0 })
  views: number;

  @Index()
  @Column({ comment: '分类ID' })
  categoryId: number;
}
